// pages/share/share.js
Page({

  data: {
  page:2,
  arr_res:[],
  buttonText:'点出查看更多'
  },

  onLoad: function (options) {
    var that = this
    wx.request({
      // url: 'https://xcx.guonong8.com/Api/House/houseindex',
      url: 'http://www.weshoppma.com/Api/Share/telCate',
      data: {
        page: 1
      },
      success: function (res) {
        that.setData({
          arr_res: res.data.pdtlist,
          loadingHidden: true
        });
        console.log(that.data.arr_res);
      },
      fail: function (error) {
        console.log(error);
        that.setData({
          request_fail: true,
        });
      }
    })
  },

  // 点击加载更多
  getMore: function (e) {
    var that = this;
    var page = that.data.page;
    wx.request({
      url: 'http://www.weshoppma.com/Api/Share/getlist',
      method: 'post',
      data: { page: page },
      header: {
        'Content-Type': 'application/x-www-form-urlencoded'
      },
      success: function (res) {
        var prolist = res.data.prolist;
        if (prolist == '') {
          wx.showToast({
            title: '没有更多数据！',
            duration: 2000,
            
          });
          that.setData({
            buttonText:'我是有底线的'
          });
          return false;
        }
        //that.initProductData(data);
        that.setData({
          page: page + 1,
          arr_res: that.data.arr_res.concat(prolist)
        });
        //endInitData
      },
      fail: function (e) {
        wx.showToast({
          title: '网络异常！',
          duration: 2000
        });
      }
    })
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  }
})